/* ===================
   整条侧栏整体样式
   =================== */
.sidebar {
    position: fixed;
    top: 45px;
    left: 0;
    width: 150px;
    height: calc(100vh - 45px);
    background-color: #0066CC;
    display: flex;
    justify-content: flex-start;   /* 原本是 center，改为紧贴左侧 */
    align-items: flex-start;
    padding-top: 40px;
    padding-left: 0;               /* 移除水平内边距 */
    box-sizing: border-box;
    z-index: 100;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.5);
}

/* ===================
   控件核心（延续你原先的风格）
   =================== */
.radio-container {
    --main-color: #FFFFFF;
    --main-color-opacity: #5ec9f31c;
    --total-radio: 6;
    display: flex;
    flex-direction: column;
    position: relative;
    align-items: flex-start;
    padding-left: 0.5rem;
}

.radio-container input {
    cursor: pointer;
    appearance: none;
}

.radio-container label {
    cursor: pointer;
    padding: 1rem 1.5rem;
    position: relative;
    color: #d1e8f0; /* 柔和蓝灰字色 */
    font-size: 16px;
    letter-spacing: 1px;
    transition: all 0.3s ease-in-out;
}

.radio-container input:checked + label {
    color: var(--main-color);
}

/* 滑动光线轨迹容器 */
.radio-container .glider-container {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    background: linear-gradient(
            0deg,
            rgba(0, 0, 0, 0) 0%,
            rgba(10, 30, 50, 1) 50%,
            rgba(0, 0, 0, 0) 100%
    );
    width: 2px;
}

.radio-container .glider-container .glider {
    position: relative;
    height: calc(100% / var(--total-radio));
    width: 100%;
    background: linear-gradient(
            0deg,
            rgba(0, 0, 0, 0) 0%,
            var(--main-color) 50%,
            rgba(0, 0, 0, 0) 100%
    );
    transition: transform 0.5s cubic-bezier(0.37, 1.95, 0.66, 0.56);
}

.radio-container .glider-container .glider::before {
    content: "";
    position: absolute;
    height: 60%;
    width: 300%;
    top: 50%;
    transform: translateY(-50%);
    background: var(--main-color);
    filter: blur(10px);
}

.radio-container .glider-container .glider::after {
    content: "";
    position: absolute;
    left: 0;
    height: 100%;
    width: 150px;
    background: linear-gradient(
            90deg,
            var(--main-color-opacity) 0%,
            rgba(0, 0, 0, 0) 100%
    );
}

/* ===================
   滑块切换动画逻辑
   =================== */
.radio-container input:nth-of-type(1):checked ~ .glider-container .glider {
    transform: translateY(0);
}
.radio-container input:nth-of-type(2):checked ~ .glider-container .glider {
    transform: translateY(100%);
}
.radio-container input:nth-of-type(3):checked ~ .glider-container .glider {
    transform: translateY(200%);
}
.radio-container input:nth-of-type(4):checked ~ .glider-container .glider {
    transform: translateY(300%);
}
.radio-container input:nth-of-type(5):checked ~ .glider-container .glider {
    transform: translateY(400%);
}
.radio-container input:nth-of-type(6):checked ~ .glider-container .glider {
    transform: translateY(500%);
}

/* 顶栏整体样式 */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background-color: #2f2f2f; /* 深灰色 */
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    z-index: 1000;
}

/* 左侧标题 */
.topbar-left .system-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

/* 右侧用户区 */
.topbar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* 用户名 */
.topbar-right .username {
    font-size: 16px;
    color: #e0e0e0;
}

/* 用户头像 */
.user-avatar {
    width: 30px;
    height: 30px;
    object-fit: cover;
    border: 2px solid #555;
}

/* 注销按钮 */
.logout-btn {
    background-color: #444;
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.logout-btn:hover {
    background-color: #666;
}


.content {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 20px;
    padding: 30px;
    margin-left: 150px; /* 避开侧栏 */
    margin-top: 60px;   /* 避开顶栏 */
    background-color: #f8f9fb;
    min-height: calc(100vh - 60px);
    box-sizing: border-box;
}

/* 卡片整体 */
.card {
    box-sizing: border-box;
    width: 190px;
    height: 254px;
    background: rgba(217, 217, 217, 0.58);
    border: 1px solid white;
    box-shadow: 12px 17px 51px rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(6px);
    border-radius: 17px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.4s ease;
    display: flex;
    flex-direction: column;
    user-select: none;
}

.card:hover {
    border: 1px solid black;
    transform: scale(1.05);
}

.card:active {
    transform: scale(0.95) rotateZ(1.7deg);
}

.book-cover-wrapper {
    height: 80%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f0f0f0;
    border-top-left-radius: 17px;  /* 与卡片保持一致 */
    border-top-right-radius: 17px; /* 与卡片保持一致 */
    overflow: hidden; /* 裁切封面图片超出部分 */
}

.book-cover {
    width: 90%;
    height: auto;       /* 自动保持比例 */
    object-fit: contain;

    border-radius: 10px; /* 轻微圆角更自然 */
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}


/* 下方信息区域 */
.book-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 5px 10px;
    text-align: center;
}

/* 书名：更醒目 */
.book-title {
    margin: 5px 0 3px 0;
    font-size: 16px;
    font-weight: bold;
    color: #000;
    line-height: 1.2;
}

/* 作者名：较淡 */
.book-author {
    margin: 0;
    font-size: 13px;
    color: #555;
}

/* 悬停时封面微微上移并突出 */
.card:hover .book-cover {
    transform: translateY(-8px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
}

/* 悬停时标题更亮更醒目，作者更淡 */
.card:hover .book-title {
    color: #000;
    transform: scale(1.08);
}

.card:hover .book-author {
    color: #888;
    opacity: 0.7;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 15px;
}

.history-card {
    position: relative;
    background: #fff;
    border-radius: 16px;
    padding: 16px 20px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.history-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(0,0,0,0.08);
}

.history-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.book-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

.book-status {
    font-size: 0.95rem;
    font-weight: 500;
}

.book-dates {
    flex: 1;
    color: #666;
    font-size: 0.9rem;
}

.book-dates p {
    margin: 2px 0;
}

.delete-btn {
    background-color: #ff4d4f;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}

.delete-btn:hover {
    background-color: #d9363e;
}

/* 🔴 角标样式 */
.tag-overdue {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #ff4d4f;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
}
/* 🔵 归还按钮样式 */
.return-btn {
    background: #007bff;
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    flex-shrink: 0;
}

.return-btn:hover {
    background: #0056b3;
    transform: translateY(-2px);
}

.return-btn:active {
    transform: scale(0.96);
}

body {
    font-family: "Segoe UI", "PingFang SC", sans-serif;
    background: #f7f8fa;
}

/* 搜索区容器整体：上方居中 */
.search-container {
    position: absolute;
    top: 100px; /* 离页面顶部距离（可根据导航栏高度调整） */
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 5;
}

/* ===== 自定义下拉框 ===== */
.custom-dropdown {
    position: relative;
    width: 160px;
    user-select: none;
    font-size: 15px;
}

.dropdown-selected {
    background: #fff;
    border-radius: 50px;
    padding: 10px 16px;
    font-size: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: box-shadow 0.2s ease;
}

.dropdown-selected:hover {
    box-shadow: 0 0 0 3px #007bff33;
}

.dropdown-selected span {
    color: #333;
}

.dropdown-arrow {
    font-size: 12px;
    color: #666;
    transition: transform 0.3s ease;
}

.custom-dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-list {
    position: absolute;
    top: 110%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
    transition: all 0.25s ease;
    z-index: 10;
}

.custom-dropdown.open .dropdown-list {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.dropdown-option {
    padding: 10px 16px;
    cursor: pointer;
    font-size: 15px;
    transition: background 0.2s ease;
}

.dropdown-option:hover {
    background: #007bff;
    color: white;
}

/* ===== 搜索框样式 ===== */
.search-box {
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 50px;
    padding: 8px 16px;
    width: 380px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 16px;
    padding: 8px;
    background: transparent;
}

.search-btn {
    background: #007bff;
    border: none;
    color: white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    transition: background 0.25s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

.search-btn:hover {
    background: #0056b3;
}

.search-icon {
    width: 20px;
    height: 20px;
    stroke: white;
    stroke-width: 2;
    fill: none;
}

/* ===== 搜索结果 ===== */
#search-result {
    margin-top: 40px;
    padding: 10px;
    margin-left: 150px; /* 同样避开侧栏 */
}

/* ===== 搜索结果卡片布局 ===== */
.book-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 20px;
    margin: 30px 60px;
}

.book-card {
    width: 190px;
    height: 254px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.book-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.2);
}

.book-cover {
    width: 100%;
    height: 70%;
    overflow: hidden;
}

.book-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px 12px 0 0;
}

.book-info {
    padding: 10px;
    text-align: center;
}

.book-title {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    margin-bottom: 4px;
}

.book-author {
    font-size: 14px;
    color: #777;
}

/* 整体容器：排除侧栏(150px)和顶栏(60px)后，剩余区域居中显示 */
.personal-center {
    position: absolute;
    top: 60px;       /* 顶栏高度 */
    left: 150px;     /* 侧栏宽度 */
    right: 0;
    bottom: 0;

    display: flex;
    justify-content: center;
    align-items: center;

    background: #f5f7fa; /* 和你的风格一致 */
    overflow: auto;
}

/* 内层容器，避免内容太宽 */
.personal-inner {
    width: 100%;
    max-width: 900px;

    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px;
}

/* 编辑资料整体布局（头像 + 表单） */
.edit-profile-container {
    display: flex;
    gap: 40px;
    align-items: flex-start;
}

/* 卡片 */
.edit-card {
    background: #fff;
    padding: 25px 30px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    width: 350px;
}

/* 头像区域 */
.avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 15px;
}

.avatar-section img {
    width: 200px;
    height: 200px;
    border-radius: 10px;
    object-fit: cover;
    cursor: pointer;
}

#avatar-upload {
    margin-top: 10px;
}

/* 表单 */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    font-size: 14px;
    color: #555;
}

.form-group input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    outline: none;
    margin-top: 5px;
}

.form-group input:focus {
    border-color: #007bff;
}

/* 按钮组 */
.btn-group {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
}

.save-btn, .pwd-btn {
    flex: 1;
    padding: 8px 0;
    border: none;
    cursor: pointer;
    border-radius: 6px;
    font-size: 14px;
}

.save-btn {
    background: #4CAF50;
    color: white;
    margin-right: 8px;
}

.pwd-btn {
    background: #007bff;
    color: white;
}

/* 弹窗遮罩 */
.modal {
    display: none; /* 通过 JS 控制显示 */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    justify-content: center;
    align-items: center;
}

/* 弹窗内容 */
.modal-content {
    background: #fff;
    padding: 25px 30px;
    border-radius: 8px;
    width: 350px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.25);
}

.modal-content input {
    width: 100%;
    padding: 8px 10px;
    margin: 10px 0;
    border: 1px solid #ccc;
    border-radius: 6px;
}

/* 弹窗按钮 */
.modal-btns {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
}

.modal-btns button {
    flex: 1;
    padding: 8px 0;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

#confirm-change {
    background: #4CAF50;
    color: white;
    margin-right: 8px;
}

#cancel-change {
    background: #ccc;
}

